import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import tailwindcss from '@tailwindcss/vite'
import compressPlugin from 'vite-plugin-compression'
// https://vite.dev/config/
export default defineConfig({
  plugins: [react(),tailwindcss(),
    {
      name:'my-plugin',
      transform(code){
        return code.replace(/console\.log/g,'console.info' )
      }
    },
    compressPlugin({
      algorithm:'gzip'
    })
  ],
  esbuild:{
    drop:['console','debugger']
  },
  
   server: {
    proxy: {
      '/api': {
        target: 'http://blogapi.shbwyz.com',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/api/, ''),
      },

      '/youdao': {
        target: 'https://openapi.youdao.com',
        changeOrigin: true,
        rewrite: (path) => path.replace(/^\/youdao/, ''),
      },
    },
  }
})
